#include <stdio.h>

int main(void) {
    int n;
    while (scanf("%d", &n) != EOF) {
        int now = 2;
        int first = 1;
        while (n != 1 && n >= now) {
            if (n % now == 0) {
                int count = 0;
                while (n % now == 0) {
                    n /= now;
                    count++;
                }
                if (first == 1) {
                    first = 0;
                } else {
                    putchar('*');
                }
                if (count == 1) {
                    printf("%d", now);
                } else {
                    printf("%d^%d", now, count);
                }
            } else {
                now == 2 ? now++ : (now += 2);
                if (now * now > n) {
                    if (first == 1) {
                        first = 0;
                    } else {
                        putchar('*');
                    }
                    printf("%d", n);
                    break;
                }
            }
        }
        putchar('\n');
    }
}
